package com.learn.springlearn.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.Executor;

@RestController
@RequestMapping("executor")
public class ExecutorController {


    @Autowired
    private Executor executor;


    @GetMapping("/dosomething")
    public void executor(){
        int i = Runtime.getRuntime().availableProcessors();
        System.out.println(i);

        executor.execute(()->{
            System.out.println(Thread.currentThread().getName()+"执行中");
        });
    }
}
